$(document).ready(function(){
//open popup
//$("#pop").click(function(){
  $("#overlay_form").fadeIn(1000);
  $(".background_overlay").fadeIn(500);
  positionPopup();
//});
//close popup
$("#close, .background_overlay").click(function(){
 $("#overlay_form").fadeOut(500);
 $(".background_overlay").fadeOut(500);
});
});
//position the popup at the center of the page
function positionPopup(){
  if(!$("#overlay_form").is(':visible')){
    return;
  }
  $("#overlay_form").css({
      left: ($(window).width() - $('#overlay_form').width()) / 2,
      top: ($(window).width() - $('#overlay_form').width()) / 7,
      position:'absolute'
  });
}
//maintain the popup at center of the page when browser resized
$(window).bind('resize',positionPopup);

document.write('<a style="display:none;" href="#" id="pop" >PopUp</a><br /><div class="background_overlay" style="display:none"></div><div id="overlay_form" style="display:none;text-align:center;">    <p style="font-size:28px"> Website đóng cửa do phạm luật</p>    <p style="font-size:18px"> Ai muốn code full trang này thì <a href="//email.bendoi.vn" target="_blank">liên hệ </a>để nhận free</p> <a href="#" id="close" ></a></div>');
document.write('<style>#overlay_form{ position: absolute; border: 9px solid #69AE60; padding: 10px; background: white; width: 270px; height: 190px; z-index: 99999;color: #000;line-height: 39px;box-shadow: 0 0 100px 50px #1A1A1A;}.background_overlay { position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; z-index: 1; background:black; opacity: 0.5;}</style>');
